import React from 'react';
import { connect } from 'umi';
import ReactToPrint from "react-to-print";
import { Card, Button } from 'antd';

class ViewPage extends React.Component<any, any> {
    constructor(props: any) {
        super(props);
        this.state = {
            loading: false,
        };
    }
    printArea: any = React.createRef();
    render() {

        return (
            <>
                <div style={{textAlign:"right"}}>
                <Button type="default">
                    <ReactToPrint
                        key="S1"
                        trigger={() => <a href="#">打印</a>}
                        content={() => this.printArea}
                    />
                </Button>
                </div>
                <div ref={(ref) => (this.printArea = ref)}>
                    {this.props.children}
                </div>
            </>
        );
    }
}
export default connect(({ Abp }: API.IConnectState) => ({
    response: Abp.response,
    currentUser: Abp.currentUser,
}))(ViewPage);
